package com.bridgeQQ.client.control.commands
{
	import com.bridgeQQ.client.core.ICommand;
	import com.bridgeQQ.client.model.BridgeModel;
	
	import mx.collections.ArrayCollection;
	
	public class AddFriendTypeCommand extends BaseWrapper implements ICommand
	{
		public function AddFriendTypeCommand(respond:BaseRespond)
		{
			super(respond);
		}
		
		protected override function result(info:Object):void
		{
			var result:Object = info.respond.value;
			if(result == null || result.result == null)
			{
				fault(info);
				return;
			}
			var types:ArrayCollection = BridgeModel.instance.possess.friendTypes;
			//change name
			if(info.item.id)
			{
				return;
			}
			types.removeItemAt(types.getItemIndex(info.item));
			types.addItem(result.result);
		}
		
		protected override function fault(info:Object):void
		{
			
		}
		
	}
}